<?
//反查订单的权限
$vcode_saccount = array(502140);
?>

<title><?=$v['title']?></title>
<script src="js/ui/PopWindow.js" type="text/javascript"></script>
<script src="js/zy_Calendar.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/default.css"/>
<link rel="stylesheet" type="text/css" href="css/page.css"/>
<link rel="stylesheet" type="text/css" href="css/sell_product.css"/>
<link rel="stylesheet" href="css/buyProduct.css" />
<link href="http://www.12301.cc/cyb_test/ajax/testa/css/searchSuggest.css" type="text/css" rel="stylesheet" />
<script src="js/select2.js"></script>
<script type="text/javascript" src="http://www.12301.cc/cyb_test/ajax/testa/js/test.js"></script>
<script type="text/javascript" src="http://www.12301.cc/cyb_test/ajax/testa/js/test_a.js"></script>
<script type="text/javascript" src="http://www.12301.cc/js/global/www.12301.cc.global.js"></script>
<link rel="stylesheet" type="text/css" href="css/select2.css">
<div class="rigArea">
	<div class="topTit"><span class="txt"><strong>已<?=($v['from'] == 'sale')? '卖出':'买到'?>的产品</strong></span></div>
	<div id="searchWrap" class="searchWrap">
		<form action="<?=$_SERVER['PHP_SELF']?>" class="report" id="orderSearchForm">
			<input type="hidden" name="act" id="act" />
			<input type="hidden" name="atype" value="<?=$atype?>" />
			<input type="hidden" name="currentPage" value="1"/>
			<input type="hidden" name="status" id="status" value="<?=$_REQUEST['status']?>"/>
			<div class="line linea">
				<span class="lt">订单时间：</span>
				<select class="timeSelect controls" name="xtimes" id="">
					<option <?=$_REQUEST['xtimes']=="1"?"selected":""?> value="1">下单时间</option>
					<option <?=$_REQUEST['xtimes']=="2"?"selected":""?> value="2">预计游玩</option>
					<option <?=$_REQUEST['xtimes']=="3"?"selected":""?> value="3">完成时间</option>
				</select>
				<input type="text" name="begintime" id="op" class="inputText date controls" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" value="<?=$_REQUEST['begintime']?>"/>
				<span>至</span>
				<input type="text" name="endtime" id="ed" class="inputText date controls"  onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" value="<?=$_REQUEST['endtime']?>"/>
				<span class="sst">汇总时间：</span>
				<a href="#" title="yestoday" class="qc quickDate fqc">昨天</a>
				<a href="#" title="today" class="qc quickDate">今天</a>
				<!-- <a href="#" title="tomorrow" class="qc quickDate">明天</a> -->
				<a href="#" title="week" class="qc quickDate">本周</a>
				<a href="#" title="lastWeek" class="qc quickDate">上周</a>
				<a href="#" title="month" class="qc quickDate">本月</a>
				<a href="#" title="lastMonth" class="qc quickDate">上月</a>
				<i class="calendarBtn c1"></i>
				<i class="calendarBtn c2"></i>
			</div>
			<div class="line lineb">
				<span class="lt">查询条件：</span>
				<select class="condSelect controls" name="tjs" id="condSelect">
					<option <?=$_REQUEST['tjs']=="0"?"selected":""?> value="0">订单号</option>
					<option <?=$_REQUEST['tjs']=="1"?"selected":""?> value="1">产品名称</option>
					<option <?=$_REQUEST['tjs']=="2"?"selected":""?> value="2">取票人姓名</option>
					<option <?=$_REQUEST['tjs']=="3"?"selected":""?> value="3">取票人手机</option>
					<option <?=$_REQUEST['tjs']=="6"?"selected":""?> value="6">远端订单号</option>
                <?if(in_array($_SESSION['saccount'],$vcode_saccount)){?>
                    <option <?=$_REQUEST['tjs']=="7"?"selected":""?> value="7">凭证码</option>
                <?}?>
				</select>
				<input id="condInput" type="text" class="condText controls" value="<?=$_REQUEST['txt']?>" name="txt"/>
				<?$DistorsNames = ($v['from'] == 'sale') ? $disList:$supList;?>
				<?if($_SESSION['sid']==1):?>
				<span class="lt">供应商：</span>
                <?if($_SESSION['sid']==1){//是管理员的情况?>
					<div id="searchSuggest">
                        <?
                        if($_GET['supplier']){
                            $sel_supplier = "select dname from pft_member where id={$_GET['supplier']} limit 1";
                            $GLOBALS['le']->query($sel_supplier);
                            $row_s_dname=$GLOBALS['le']->fetch_assoc();
                        }
                        ?>
						<input type="text" id="suggest_input" autocomplete="off" value="<?=$row_s_dname['dname'] ? $row_s_dname['dname']:点击搜索供应商?>" onfocus="if (value =='点击搜索供应商'){value =''}" onblur="if (value ==''){value='点击搜索供应商'}"/>
						<input type="hidden" name="supplier" id="li_id" value="<?=$_GET['supplier']?>"/>
						<input type="hidden"  id="lid_id" value="0"/>
						<ul id="suggest_ul">
						</ul>
					</div>
                <?}else{?>
				<select class="fenxiaoSelect controls" name="supplier" id="bindList">
					<option value="">请选择供应商</option>
					<?foreach($DistorsNames as $key=> $cn):?>
					<option value="<?=$key?>" <?if($_REQUEST['supplier']==$key)echo 'selected="selected"'?>><?=$cn?></option>
					<?endforeach;}?>
				</select>
				<script>
					$("#bindList").select2({
						placeholder: "Select a State",
						allowClear: true
					});
				</script>
				<?
                endif;
                $_REQUEST['status']=is_array($_REQUEST['status']) ? $_REQUEST['status'] : array();
                $_REQUEST['payinfo']=is_array($_REQUEST['payinfo']) ? $_REQUEST['payinfo'] : array();
				$DistorsNames = ($v['from'] == 'sale') ? $disList:$supList;
                ?>
				<span class="lt"><?=($v['from'] == 'sale')?'分销商':'供应商'?>：</span>
				<!--controls-->
                <?if($_SESSION['sid']==1){//是管理员的情况?>
                 <div id="searchSuggest_a">
                        <?
                        if($_GET['distributor']){
                            $sel_distributor = "select dname from pft_member where id={$_GET['distributor']} limit 1";
                            $GLOBALS['le']->query($sel_distributor);
                            $row_d_dname=$GLOBALS['le']->fetch_assoc();
                        }
                        ?>
						<input type="text" id="suggest_input_a" autocomplete="off" value="<?=$row_d_dname['dname'] ? $row_d_dname['dname']:点击搜索分销商?>"  onfocus="if (value =='点击搜索分销商'){value =''}" onblur="if (value ==''){value='点击搜索分销商'}"/>
						<input type="hidden" name="distributor" id="li_id_a" value="<?=$_GET['distributor']?>"/>
                        
						<input type="hidden" id="lid_id_a" value="1"/>
						<ul id="suggest_ul_a">
						</ul>
				</div>
                <?}else{?>
				<select class="fenxiaoSelect " name="<?=($v['from'] == 'sale')?'distributor':'supplier'?>" id="bindList2">
					<option value="">请选择<?=($v['from'] == 'sale')?'分销商':'供应商'?></option>
					<?foreach($DistorsNames as $key=>$cn):?>
					<option value="<?=$key?>" <?if($_REQUEST['distributor']==$key || ($_REQUEST['supplier']==$key && $_SESSION['memberID']!=1)) echo 'selected="selected"'?>><?=$cn?></option>
					<?endforeach;}?>                    
                    <?/*if($v['from'] == 'sale'){?>
                    <option value="1sanke" <?if($_REQUEST['supplier']=='1sanke')echo 'selected="selected"'?>>散客</option>
                    <?}*/?>
				</select> 
				<script>
					$("#bindList2").select2({
						placeholder: "Select a State",
						allowClear: true
					});
				</script>
			</div>
            <div id='vcode_landname' class="line linec" style='display:<?=$_REQUEST['tjs']=="7"?"block":"none"?>;margin-bottom:8px'>
                <span class="lt">景区名称：</span>
                <input name='vcode_landname' class='condText controls' style='width:300px' value='<?=$_REQUEST['vcode_landname']?>'/>
            </div>
			<div class="line linec">
				<span class="lt">订单状态：</span>
				<label for="labcheckaa"><input type="checkbox" class="checkbox" name="status[]" value="0" <?=(in_array(0,$_REQUEST['status']))?"checked":""?>/><span class="checkboxT">未使用</span></label>
				<label for="labcheckab"><input type="checkbox" class="checkbox" name="status[]" value="1" <?=(in_array(1,$_REQUEST['status']))?"checked":""?>/><span class="checkboxT">已使用</span></label>
				<label for="labcheckac"><input type="checkbox" class="checkbox" name="status[]" value="2" <?=(in_array(2,$_REQUEST['status']))?"checked":""?>/><span class="checkboxT">已过期</span></label>
				<label for="labcheckad"><input type="checkbox" class="checkbox" name="status[]" value="3" <?=(in_array(3,$_REQUEST['status']))?"checked":""?>/><span class="checkboxT">已取消</span></label>
            <?if($_SESSION['sdtype']==9){?>
                <label for="labcheckad"><input type="checkbox" class="checkbox" name="status[]" value="4" <?=(in_array(4,$_REQUEST['status']))?"checked":""?>/><span class="checkboxT">凭证码被替代</span></label>
                <label for="labcheckad"><input type="checkbox" class="checkbox" name="status[]" value="5" <?=(in_array(5,$_REQUEST['status']))?"checked":""?>/><span class="checkboxT">被终端修改</span></label>
                <label for="labcheckad"><input type="checkbox" class="checkbox" name="status[]" value="6" <?=(in_array(6,$_REQUEST['status']))?"checked":""?>/><span class="checkboxT">被终端撤销</span></label>
                <label for="labcheckad"><input type="checkbox" class="checkbox" name="status[]" value="7" <?=(in_array(7,$_REQUEST['status']))?"checked":""?>/><span class="checkboxT">部分使用</span></label>
            <?}?>
			</div>
			<div class="line linec">
				<span class="lt">支付方式：</span>
				<label for="labcheckba"><input type="checkbox" name="payinfo[]" <?=(in_array(0,$_REQUEST['payinfo']))?"checked":""?> value="0" class="checkbox"/><span>帐户余额</span></label>
				<label for="labcheckbb"><input type="checkbox" name="payinfo[]" <?=(in_array(1,$_REQUEST['payinfo']))?"checked":""?> value="1" class="checkbox"/><span>在线支付</span></label>
				<label for="labcheckbc"><input type="checkbox" name="payinfo[]" <?=(in_array(2,$_REQUEST['payinfo']))?"checked":""?> value="2" class="checkbox"/><span>授信支付</span></label>
                <label for="labcheckbc"><input type="checkbox" name="payinfo[]" <?=(in_array(5,$_REQUEST['payinfo']))?"checked":""?> value="5" class="checkbox"/><span>微信支付</span></label>
			</div>
			<div class="formBtnW">
				<input id="queryProductBtn" type="submit" value="查 询" class="queryBtn searchBtn" />
				<a href="javascript:void(0);" class="dcexcleBtn searchBtn" id="excel">导出excle</a>
			</div>
		</form>
	</div>
	<?php if($_SESSION['sid']==1 ):?>
<!--        && $_GET['txt']==''&&$_GET['supplier']==''&&$_GET['distributor']==''-->
        <div id="totalSumW" class="totalSumW" >
            <p class="thisPage" style="/*display:none*/"><span class="span1">统计所有(含转分销)：</span>&nbsp;&nbsp;&nbsp;<span class="span1">订单数<i class="i ia green" id="total_onum"><?=$count_total[0]?></i>单</span><span>数 量<i class="i ib red" id="total_tnum"><?=$count_total[1]?></i></span><span>总金额<i class="i ic orange"  id="total_mnum"><?=$count_total[2]/1000000?></i>万元</span></p>
            <p class="allPage" style="display:none;"><button id="getAllpagemonery">统计所有</button></p>
        </div>
        <div id="totalSumW" class="totalSumW" >
            <p class="thisPage" style="/*display:none*/"><span class="span1">统计所有(不含转分销)：</span><span class="span1">订单数<i class="i ia green" id="total_onum"><?=$count_total_lastLevel[0]?></i>单</span><span>数 量<i class="i ib red" id="total_tnum"><?=$count_total_lastLevel[1]?></i></span><span>总金额<i class="i ic orange"  id="total_mnum"><?=$count_total_lastLevel[2]/1000000?></i>万元</span></p>
            <p class="allPage" style="display:none;"><button id="getAllpagemonery">统计所有</button></p>
        </div>
	<?php endif;?>
	<table id="listTable" class="proTable fixed">
		<thead id="proTableHead">
			<th class="col_1">订单号</th>
			<th class="col_2">产品信息</th>
			<th class="col_3">取票人信息</th>
			<? echo  ($v['from']=='buy') ? '<th class="col_4">供应商</th>':'<th class="col_4">分销商</th>';?>
			<th class="col_5">支付方式</th>
			<th class="col_6">订单状态</th>
			<th class="col_7">总金额</th>
			<th class="col_8">操作</th>
		</thead>
		<tbody>
			<!-- 第1个产品 -->
			<? //print_r($r);
			foreach($r as $row):
				$childNum = count($row['childOrder']);
			?>
			<tr class="listHead">
				<td colspan="8">
					<div>
						<a href="scenicDetail.html?lid=<?=(string)$row['mainOrder']->UUlid?>" title="<?=(string)$row['mainOrder']->UUltitle?>" class="title" target="_blank"><?=(string)$row['mainOrder']->UUltitle?></a>
						<p class="rt">
							<span class="span">下单时间：<?=(string)$row['mainOrder']->UUordertime?></span>
							<span class="span">有效期：<?=(string)$row['mainOrder']->UUbegintime?> 至 <?
                                if((string)$row['mainOrder']->UUp_type == 'F') {
                                    //套票的话要去获取子票的时间
                                    $or    = new OrderRecord((int)$row['mainOrder']->UUordernum,$s);
                                    $child_row = $or->info();
                                    echo (string)$child_row['childOrder'][0]->UUendtime;
                                }
                                else echo $row['mainOrder']->UUendtime ;
                                ?></span>
							<span class="span span3">验证时间：<?=(string)$row['mainOrder']->UUdtime!="0000-00-00 00:00:00"?(string)$row['mainOrder']->UUdtime:"未验证"?></span>
						</p>
					</div>
				</td>
			</tr>
			<tr class="listBody <?if(!$childNum)echo 'borderBottom';?>" >
				<td class="col_1 col" rowspan="<?=$childNum + 1?>">
				<?if((string)$row['mainOrder']->UUp_type=='F'):?>
				<a target="_blank" href="orderView.html?from=<?=$v['from']?>&ordernum=<?=$row['mainOrder']->UUordernum?>&type=<?=$row['mainOrder']->UUp_type?>&pack=1" class="ordernb"><?=(string)$row['mainOrder']->UUordernum?></a>
				<?else:?>
					<?if(isMainOrder($row['mainOrder']->UUconcat_id)):?>
					<a target="_blank" href="orderView.html?from=<?=$v['from']?>&ordernum=<?=$row['mainOrder']->UUordernum?>&type=<?=$row['mainOrder']->UUp_type?>&pack=1" class="ordernb"><?=(string)$row['mainOrder']->UUordernum?></a>
					<?else:?>
					<a target="_blank" href="orderView.html?from=<?=$v['from']?>&ordernum=<?=$row['mainOrder']->UUordernum?>&type=<?=$row['mainOrder']->UUp_type?>" class="ordernb"><?=(string)$row['mainOrder']->UUordernum?></a>
					<?endif;?>
				<?endif;?>
                <?if((string)$row['mainOrder']->UUremotenum){?>
				<span class="f_orderNum"><?=(string)$row['mainOrder']->UUremotenum?></span>
				<?}?>
				</td>
				<td class="col_2 col">
				【<?=(string)$row['mainOrder']->UUttitle?>】<span class="numPrice"> * <i><?=(string)$row['mainOrder']->UUtnum?></i> 张 * &yen;<i><?=(string)$row['mainOrder']->UUtprice/100?></i></span>
				</td>
				<td class="col_3 col" rowspan="<?=$childNum + 1?>">
					<p class="name"><?=(string)$row['mainOrder']->UUordername?></p>
					<p class="tell"><?=(string)$row['mainOrder']->UUordertel?></p>
				</td>
				<?if($showDtr){?>
				<td class="col_4 col" rowspan="<?=$childNum + 1?>">
				<?
                    if($_SESSION['dtype']==2){// 直接供应方（景区）只看到供应商
                        echo $anames[(int)$row['mainOrder']->UUsellid]?
                        $anames[(int)$row['mainOrder']->UUsellid]:(string)$row['mainOrder']->UUdname;
                    }elseif($v['from']=='buy'){// 已买到
						echo $anames[(int)$row['mainOrder']->UUsellid]?
						$anames[(int)$row['mainOrder']->UUsellid]:(string)$row['mainOrder']->UUdname;
					}else{// 已卖出
						echo $fnames[(int)$row['mainOrder']->UUbuyid]?
						$fnames[(int)$row['mainOrder']->UUbuyid]:(string)$row['mainOrder']->UUdname;
					}
				?>
				</td>
				<?}?>
				<td class="col_5 col" rowspan="<?=$childNum + 1?>">
					<?=OrderRecord::$paymodeT[(string)$row['mainOrder']->UUpmode]?>
					<?if($row['mainOrder']->UUordermode==9){?>
						</br><em class="fuchsia">(会员卡预定)</em>
					<?}elseif($row['mainOrder']->UUordermode!=0){?>
						</br><em class="fuchsia">(散客预定)</em>
					<?}?>

				</td>
				<td class="col_6 col" rowspan="<?=$childNum + 1?>">
				<span rowspan="<?=$row['totalOrder']?>">
                    <p>
                        <?
                        
                        if((string)$row['mainOrder']->UUpaystatus==1){
                            echo $uuStatus[(string)$row['mainOrder']->UUstatus];
                        }elseif((string)$row['mainOrder']->UUstatus==3 && (string)$row['mainOrder']->UUpaystatus==2){
                            echo $uuStatus[(string)$row['mainOrder']->UUstatus];
                            //echo '<br/><span style="color:orange;">(未支付)</span>';
                        }else{
                            echo $uuStatus[(string)$row['mainOrder']->UUstatus];
                        }
                        ?>
            
                        <?if((string)$row['mainOrder']->UUstatus==2 && (string)$row['mainOrder']->UUpaystatus==2) echo '<br/><span style="color:red;">(未支付)</span>';?>
                    </p>

                    <p class="green">
					<?if($row['mainOrder']->UUstatus==0){?>
					<?=OrderRecord::$paystatusT[(string)$row['mainOrder']->UUpaystatus]?>
					<?}?>
					</p>
				</td>
				<td class="col_7 col" rowspan="<?=$childNum + 1?>">

					<?if(!isMainOrder($row['mainOrder']->UUconcat_id)):?>
					合计<span class="totalPrice">&yen;<i><?=((int)$row['mainOrder']->UUtprice*(int)$row['mainOrder']->UUtnum)/100?></i></span>
					<?else:?>
					<?
						$total = 0;
						foreach($row['childOrder'] as $cr){
							// $total = $total + (string)$cr['totalPrice']/100 ;
							$total = $total + ((int)$cr['mainOrder']->UUtprice*(int)$cr['mainOrder']->UUtnum)/100;
						}
						$total += ((int)$row['mainOrder']->UUtprice*(int)$row['mainOrder']->UUtnum)/100;
					?>
					合计<span class="totalPrice">&yen;<i><?=$total?></i></span>
					<?endif;?>
					
				</td>
				<td class="col_8 col" rowspan="<?=$childNum + 1?>">
				<?
					// 订单号
					$order = (string)$row['mainOrder']->UUordernum;
					//if(!isMainOrder($row['mainOrder']->UUconcat_id)){// 不是联票
						
						//查看
						$view='orderView.html?from='.$v['from'].'&ordernum=';
						$view.= $order.'&type='.$row['mainOrder']->UUp_type;
						if((string)$row['mainOrder']->UUp_type=='F' || isMainOrder($row['mainOrder']->UUconcat_id)) 
                            $view.='&pack=1';
                        if($_SESSION['sid']==1)//管理员时 链接带上购买者id 用来区分显示不同价格
                            $view.= '&aid='.(int)$row['mainOrder']->UUsellid;
						echo '<a target="_blank" href="'.$view.'">查看</a><br/>';
						
						//支付
						if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderAlipay"))
							echo '<a target="_blank" href="alipayOrder.html?ordernum='.$order.'">支付</a><br/>';
						
						// **********************************
						if((string)$row['mainOrder']->UUifpack!=2){// 不是子票的才显示取消、修改、重发
							// 取消
                            // echo "orderOperAuth($row,$memberID,$account,orderCancel)";
							if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderCancel"))
								echo '<a act="cancel" class="orderHandle" href="call/handle.php?from=order_cancel&ordernum='.$order.'">取消</a><br/>';
							// 修改
							if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderAlter")){
									$concat='';
									if(isMainOrder($row['mainOrder']->UUconcat_id)){
									echo '<a  class="alter" href="call/handle.php?from=orderAlterHtml&ordernum='.$order.'&concat=1">修改</a><br/>';
									}else{
									echo '<a  class="alter" href="call/handle.php?from=orderAlterHtml&ordernum='.$order.'">修改</a><br/>';
									}
								
                            }

							// 重发
							if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderResend"))
								echo '<a act="cancel" class="resend" href="call/handle.php?from=order_resend&&ordernum='.$order.'">重发</a><br/>';
						}

//                验证
//                /*
                if(OrderRecord::orderChkAuth($row['mainOrder'])){
                    $outdate=$s->Terminal_Code_Verify((int)$row['mainOrder']->UUordernum,$_SESSION['sid'],1);
                    $outdate=simplexml_load_string($outdate);
                    $code=$outdate->Rec[0]->UUcode;
                    echo '<a target="_blank" href="terminal_chk.html?sid='.$row['mainOrder']->UUlid.'&chk='.$code.'">验证</a><br/>';
                }
//                */
						// *********************************
					// }elseif(isMainOrder($row['mainOrder']->UUconcat_id)){//联票订单联票显示方式
						// echo '<span>复票订单<span><br/>';
						// echo '<a href="orderView.html?from='.$v['from'].'&ordernum='.$order.'&type='.$row['mainOrder']->UUp_type.'&pack=1" target="_blank">查看详细</a>';
					// }
				?>		
				<?if($_SESSION['dtype']==2 && in_array($_SESSION['account'],$arr_salerid)):?>
					<span><?=$row['mainOrder']->UUcode?></span>
				<?endif;?>
				</td>
			</tr>
			<?foreach($row['childOrder'] as $cr):?>
			<tr class="listBody borderBottom borderTop">
				<td class="col_2 col">
					【<?=(string)$cr['mainOrder']->UUttitle?>】
					<span class="numPrice"> * <i><?=(string)$cr['mainOrder']->UUtnum?></i> 张 * &yen;<i><?=(string)$cr['mainOrder']->UUtprice/100?></i></span>
				</td>
			</tr>
			<?endforeach;//子票?>
			<tr class="marTop"><td colspan="8"></td></tr>
			<?endforeach;?>
		</tbody>
	</table>
	<?page($count,$currentPage,$pageSize,$order,$by);?>
	<style>.whichPageWrap{ display:block;}</style>
</div>
<div id="theadCopy" class="theadCopy">
	<ul>
		<li>订单号</li>
		<li>产品信息</li>
		<li>取票人信息</li>
		<? echo  ($v['from']=='buy') ? '<li>供应商</li>':'<li>分销商</li>';?>
		<li>支付方式</li>
		<li>订单状态</li>
		<li>总金额</li>
		<li>操作</li>
	</ul>
</div>
<script type="text/javascript" src="js/buyProduct.js"></script>
<script type="text/javascript" src="js/plugin/date/moment.min.js"></script>
<script type="text/javascript" src="http://wx.12301.cc/public/js/common/class.js"></script>
<script>
	var popWindow=new PopWindow();
	$(".alter").click(function(){ 
		$.ajax({
			"url":$(this).attr("href"),
			"success":function(data){
				popWindow.open(data);
				$("form.changetnum input.cancel").click(function(){
					popWindow.close();
				});
				$("form.changetnum").submit(function(){
					popWindow.close();
					var str=$(this).serialize();
                    var url = "call/handle_pzp.php?from=order_alter&"+str;
                    if($("form.changetnum").attr("data")=="forward"){
                        url = "call/handle_pzp.php?from=order_forward&"+str;
                    }
					$.ajax({
						"url":url,
						"dataType":"json",
						"success":function(data){
							if(data.outcome==1){
								alert(data.msg);
								window.location=window.location.href;
							}else{
								alert(data.msg);
							}
						}
					});
					return false;
				});
				
			}
		})
		return false;
	});
	$(".orderHandle").click(function(){
		if($(this).attr("act")=="cancel"){
			if(!confirm("确定要取消该订单？")) return false;
		}
		$.ajax({
			"url":$(this).attr("href"),
			"dataType":"json",
			"success":function(data){
				if(data.outcome==1){
					alert("取消成功");
					window.location=window.location.href;
					/*$(this).parent().prev().prev().html('<em class="red">已取消</em>');
					var textT=$(this).find("a").first().text();
					$(this).parent().html(textT);*/
				}else{
					alert("取消失败"+data.msg);
				}
			}
		})
		return false;
	});
	$(".resend").click(function(){
		if($(this).attr("act")=="cancel"){
			if(!confirm("确定要重发短信？")) return false;
		}
		$.ajax({
			"url":$(this).attr("href"),
			"dataType":"json",
			"success":function(data){
				if(data.outcome==1){
					alert("重发成功");
				}else{
					alert("重发失败:"+data.msg);
				}
			}
		})
		return false;
	});
	$(".mcul li a").click(function(){
		$("#status").val($(this).attr("status"));
		$(".sbtn").click();
		return false;
	})
	
	$("#excel").click(function(){
		
		$("#act").val("Export");
		$("form.report").submit();
		$("#act").val("");
	});
</script>